var _webRoot_Path = "/HyManageSystem";
var modules = [ {
	include : true,
	incfile : _webRoot_Path+'/style/common/reset.css'
}, {
	include : true,
	incfile : _webRoot_Path+'/style/common/button_a.css'
}, {
	include : true,
	incfile : _webRoot_Path+'/style/common/list.css'
}, {
	include : true,
	incfile : _webRoot_Path+'/js/common/common.js'
}, {
	include : true,
	incfile : _webRoot_Path+'/js/common/common_dept_worker.js'
}, {
	include : true,
	incfile : _webRoot_Path+'/js/common/common_cw_subject_funds.js'
}, {
	include : true,
	incfile : _webRoot_Path+'/js/common/frameworkutil.js'
}, {
	include : true,
	incfile : _webRoot_Path+'/js/ymPrompt4/ymPrompt.js'
}, {
	include : true,
	incfile : _webRoot_Path+'/js/My97DatePicker/WdatePicker.js'
}, {
	include : true,
	incfile : _webRoot_Path+'/js/ymPrompt4/skin/vista/ymPrompt.css'
}, {
	include : true,
	incfile : _webRoot_Path+'/js/common/webtoolkit.scrollabletable.js'
}, {
	include : true,
	incfile : _webRoot_Path+'/js/common/webtoolkit.jscrollable.js'
}, {
	include : true,
	incfile : _webRoot_Path+'/js/common/jquery.tablesorter.js'
} ];

for ( var i = 0; i < modules.length; i++) {
	if (modules[i].include === true) {
		filename = modules[i].incfile;
		if (jQuery.browser.safari) {
			jQuery.ajax({
				url : filename,
				dataType : 'script',
				async : false,
				cache : true
			});
		} else {
			var fileType = filename.substring(filename.lastIndexOf('.') + 1,
					filename.length).toUpperCase();
			if (fileType == 'JS') {
				IncludeJavaScript(filename);
			} else if (fileType == 'CSS') {
				IncludeCss(filename);
			}
		}
	}
}

/**
 * 导入JS文件到页面
 * 
 * @param jsFile
 */
function IncludeJavaScript(jsFile) {
	var oHead = document.getElementsByTagName('head')[0];
	var oScript = document.createElement('script');
	oScript.type = 'text/javascript';
	oScript.charset = 'utf-8';
	oScript.src = jsFile;
	oHead.appendChild(oScript);
};

/**
 * 导入CSS文件到页面
 * 
 * @param cssFile
 */
function IncludeCss(cssFile) {
	var oHead = document.getElementsByTagName('head')[0];
	var oLink = document.createElement('link');
	oLink.rel = "stylesheet";
	oLink.type = 'text/css';
	oLink.href = cssFile;
	oHead.appendChild(oLink);
};
function showUserAccInfo(id,username){
    try {
    	if (null == id || id <= 0) {
    	        alert("请选择要操作的数据!");
    	        return false;
    	    }
        var result = {
            'userid': id
        };
        var url = _rootPath+"/v/useracc/getUserAccInfo";
        postData(url, result, function(msg){
            if (msg.infoNo == 1) {
                var constObj = eval(msg.myEntity);
                var obj = constObj[0];
                var jsonSnsList = eval(msg.myEntity);
                if(jsonSnsList.length<1){
                	alert("查询失败");
                }
                ymPrompt.win({
                    message: $('#showUserAccInfo').html(),
                    width: 600,
                    height: 300,
                    title: '用户信息'
                });
                $("#ym-window").find("#p_id").val(id);
                $("#ym-window").find("#p_username").val(username);
                $("#ym-window").find("#p_useracc_1").val(jsonSnsList[0].p1);
                $("#ym-window").find("#p_useracc_2").val(jsonSnsList[0].p2);
                $("#ym-window").find("#p_useracc_3").val(jsonSnsList[0].p3);
            }
            else {
                alert(msg.infoStr);
            }
        });
        
    } 
    catch (e) {
        alert(e.message);
        return;
    }
}
function saveEntityByUserAcc(){
    var p_balance = $("#ym-window").find("#p_useracc_1").val();
    var p_earned = $("#ym-window").find("#p_useracc_2").val();
    var p_frozen = $("#ym-window").find("#p_useracc_3").val();
    var p_id = $("#ym-window").find("#p_id").val();
    var result = {
            'p_id': p_id,
            'p_balance': p_balance,
            'p_earned': p_earned,
            'p_frozen': p_frozen
        };
        var url = _rootPath +"/v/useracc/upUserAccEntity";
        postData(url, result, function(msg){
            if (msg.infoNo == 1) {
                alert(msg.infoStr);
                window.location.reload();
            }
            else {
                alert(msg.infoStr);
            }
        });
}